package com.tsd.jxc.buy.dao;

import com.tsd.common.vo.BatchDeleteLogicVo;
import com.tsd.core.vo.PageBean;
import com.tsd.jxc.buy.entity.JxcBuyOrder;
import com.tsd.jxc.buy.entity.JxcBuyOrderExt;
import com.tsd.jxc.buy.vo.JxcBuyStockInfoVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 描述：JxcBuyOrderMapper
 *
 * @author Hillpool
 * @date 2022/07/29 15:01:23
 */
public interface JxcBuyOrderMapper {

    JxcBuyOrder selectByPrimaryKey(Long id);

    JxcBuyOrderExt selectBySid(String sid);

    int deleteByPrimaryKey(Long id);

    int insert(JxcBuyOrder record);

    int insertSelective(JxcBuyOrder record);

    int insertList(@Param("list") List<JxcBuyOrderExt> list);

    int updateByPrimaryKey(JxcBuyOrder record);

    int updateByPrimaryKeySelective(JxcBuyOrder record);

    int updateList(@Param("list") List<JxcBuyOrderExt> list);

    List<JxcBuyOrderExt> selectByEntity(JxcBuyOrderExt record);

    List<JxcBuyOrderExt> selectByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderExt> selectCount1Page(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderExt> selectByParams(@Param("params") Map<String, Object> params);

    JxcBuyOrderExt selectDuplicatedCode(JxcBuyOrderExt record);

    int deleteLogicBySidList(BatchDeleteLogicVo logicVo);

    List<JxcBuyOrderExt> selectValid4Return(@Param("list") List<String> list);

    List<JxcBuyOrderExt> selectBuyOrdersIncludeDetailByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<String> selectSidByDetailSidList(@Param("detail_sid_list") List<String> detail_sid_list);

    int updateInBill(@Param("sid_list") List<String> sid_list);

    int updateInvoiceState(@Param("invoice_list") List<String> invoice_list, @Param("state") Integer state);

    int updateInvoiceState4Xd(@Param("invoice_list") List<String> invoice_list);

    int updateInvoiceState4XdSpecial(@Param("invoice_list") List<String> invoice_list, @Param("state") Integer state);

    List<JxcBuyStockInfoVo> select4StockByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderExt> select4SelectByPage(@Param("params") Map<String, Object> params, @Param("page") PageBean page);

    List<JxcBuyOrderExt> select4CheckSale(@Param("order_list") List<String> order_list);

    int countValid(@Param("yyyy") Integer yyyy, @Param("mm") Integer mm, @Param("order_type") Integer order_type, @Param("state") Integer state);

    int countValidByParams(@Param("params") Map<String, Object> params);

    double sumValidQty4Stock(@Param("yyyy") Integer yyyy, @Param("mm") Integer mm, @Param("order_type") Integer order_type);

    double sumValidAmount4Stock(@Param("yyyy") Integer yyyy, @Param("mm") Integer mm, @Param("order_type") Integer order_type);

    JxcBuyOrderExt select4CheckAuditState(@Param("sale_order_list") List<String> sale_order_list);

    List<String> selectNeedRelatedAudit(@Param("sale_order_list") List<String> sale_order_list);

    int updateInvoiceAmount(@Param("invoice_list") List<String> invoice_list);

    List<JxcBuyOrderExt> selectBySids(@Param("sids") List<String> sids);

    List<String> selectSaleOrderList(@Param("buy_order_list") List<String> buy_order_list);

    int updateCutAmountBySidList(@Param("sid_list") List<String> sid_list);
}
